<!DOCTYPE html>
<html>
<head>
    <title>变价记录表（erp）</title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <form class="form-inline" role="form">
                <a class="btn btn-default btn-sm" @click="reset"><i class="fa fa-refresh"></i></a>
                <div class="form-group">
                    <input type="text" class="form-control input-sm" v-model="q.productId" @keyup.enter="query" placeholder="sku">
                </div>&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                    <input type="text" class="form-control input-sm" v-model="q.goodsName" @keyup.enter="query" placeholder="商品名称">
                </div>&nbsp;&nbsp;&nbsp;
                <!--<div class="form-group">-->
                    <!--&lt;!&ndash;<input type="text" class="form-control input-sm" v-model="q.goodsType" @keyup.enter="query" placeholder="商品类型">&ndash;&gt;-->
                    <!--<el-select style="width: 107px;height: 20px;" v-model="q.goodsType" placeholder="商品类型">-->
                        <!--<el-option key="standard" value="普通商品"></el-option>-->
                        <!--<el-option key="print" value="印刷商品"></el-option>-->
                        <!--<el-option key="fast" value="快印商品"></el-option>-->
                        <!--<el-option key="material" value="广告物料"></el-option>-->
                    <!--</el-select>-->
                <!--</div>&nbsp;&nbsp;&nbsp-->
                <div class="form-group">
                    <!--<input type="text" class="form-control input-sm" v-model="q.changeType" @keyup.enter="query" placeholder="变价类型">-->
                    <select class="form-control" v-model="q.changeType" placeholder="变价类型">
                        <option value="">请选择变价类型</option>
                        <option value="normal">普通</option>
                        <option value="seckill">秒杀</option>
                        <option value="group">团购</option>
                    </select>
                </div>&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                    <!--<input type="text" class="form-control input-sm" v-model="q.status" @keyup.enter="query" placeholder="变价状态">-->
                    <select class="form-control" v-model="q.status" placeholder="变价状态">
                        <option value="">请选择变价状态</option>
                        <option value="noStart">未开始</option>
                        <option value="underway">进行中</option>
                        <option value="all">全部</option>
                        <option value="end">结束</option>
                    </select>
                </div>&nbsp;&nbsp;&nbsp;
                <a class="btn btn-default btn-sm"  @click="query"><i class="fa fa-search"></i>&nbsp;查询&nbsp;&nbsp;</a>
                <#if shiro.hasPermission("goodsConfigChangePrice:goodsconfigchangeprice:save")>
                <a class="btn btn-primary btn-sm" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
            </form>
			<!--<#if shiro.hasPermission("goodsConfigChangePrice:goodsconfigchangeprice:update")>-->
                <!--<a class="btn btn-primary btn-sm" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>-->
			<!--</#if>-->
			<#if shiro.hasPermission("goodsConfigChangePrice:goodsconfigchangeprice:delete")>
                <a class="btn btn-primary btn-sm" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default col-sm-4">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">描述</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.describes" placeholder="描述"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">sku</div>
                <div class="col-sm-10">
                    <template v-if="JSON.stringify(productData) != '[]'" height="100%">
                        <el-table :data="productData" width="100%"  stripe  style="width: 100%">
                            <el-table-column prop="spu" label="商品id" width="80"></el-table-column>
                            <el-table-column prop="sku" label="产品id" width="80"></el-table-column>
                            <el-table-column prop="goodsName" label="产品名称" width="80"></el-table-column>
                            <el-table-column prop="totalPrice" label="原价格" width="80"></el-table-column>
                            <el-table-column label="新价格" width="120">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.changePrice" placeholder="请输入"></el-input>
                                </template>
                            </el-table-column>
                        </el-table>
                    </template>
                    <div v-else class="control-label" style="float:left;">温馨提示:请在右侧通过三级分类选择sku</div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">按折扣率一键修改</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.describes" placeholder="描述"/>-->
                    <el-select style="width: 107px;height: 20px;" v-model="goodsConfigChangePrice.scale" @change="setScale" placeholder="请选择">
                        <el-option :value=0.9>0.9</el-option>
                        <el-option :value=0.8>0.8</el-option>
                        <el-option :value=0.7>0.7</el-option>
                        <el-option :value=0.6>0.6</el-option>
                        <el-option :value=0.5>0.5</el-option>
                        <el-option :value=0.4>0.4</el-option>
                        <el-option :value=0.3>0.3</el-option>
                        <el-option :value=0.2>0.2</el-option>
                        <el-option :value=0.1>0.1</el-option>
                    </el-select>
                </div>
            </div>
            <!--<div class="form-group">-->
                <!--<div class="col-sm-2 control-label">扩展价变价</div>-->
                <!--<div class="col-sm-10">-->
                    <!--<input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.changeExpandPrice" placeholder="扩展价变价（大纸平板）"/>-->
                <!--</div>-->
            <!--</div>-->
            <div class="form-group">
                <div class="col-sm-2 control-label">变价类型</div>
                <div class="col-sm-10" >
                    <select  class="form-control" v-model="goodsConfigChangePrice.changeType" placeholder="请选择">
                        <option value='seckill'>秒杀</option>
                        <option value='group'>团购</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">变价参数</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.changeParam" placeholder="变价参数"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">限购单人次数</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.limitTimes" placeholder="限购单人次数"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">限购总次数</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.limitTotal" placeholder="限购总次数"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">开始时间</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.startTime" placeholder="开始时间"/>-->
                    <div class="block">
                        <el-date-picker
                                v-model="goodsConfigChangePrice.startTime"
                                type="date"
                                placeholder="开始时间"
                                format="yyyy 年 MM 月 dd 日"
                                value-format="yyyy-MM-dd HH:hh:mm">
                        </el-date-picker>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">结束时间</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.endTime" placeholder="结束时间"/>-->
                    <div class="block">
                        <el-date-picker
                                v-model="goodsConfigChangePrice.endTime"
                                type="date"
                                @change="choiceTime"
                                placeholder="结束时间"
                                format="yyyy 年 MM 月 dd 日"
                                value-format="yyyy-MM-dd HH:hh:mm">
                        </el-date-picker>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">状态</div>
                <div class="col-sm-10">
                    <!--<input type="text" class="form-control input-sm" v-model="goodsConfigChangePrice.disabled" placeholder="失效:0-不失效 1-失效"/>-->
                    <el-switch style="display: block" v-model="goodsConfigChangePrice.disabled"
                               active-color="#cbd8e6" inactive-color="##409EFF"
                               active-text="失效" inactive-text="不失效">
                    </el-switch>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary  btn-sm" @click="saveOrUpdate" value="确定"/>&nbsp;&nbsp;
                <input type="button" class="btn btn-warning  btn-sm" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
    <div class="col-sm-8" v-show="!showList"  v-if="title == '新增'">
        <div class="col-sm-5" height="100%">
            <div class="grid-btn">
                <form class="form-inline" role="form">
                    <el-button type="info" plain @click="choiceCategory()">
                        请选择三级分类
                    </el-button>
                    <div class="form-group">
                        <input type="text" class="form-control a input-sm" width="30px" v-model="spuQuery.goodsId" placeholder="商品Id">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control input-sm" v-model="spuQuery.name" placeholder="查询商品名">
                    </div>
                    <a class="btn btn-primary btn-sm" @click="loadSpuData"><i class="fa fa-search"></i>&nbsp;查询</a>
                    <div class="panel-heading">(*温馨提示:双击选择商品加载sku数据表格)</div>
                </form>
            </div>
            <template v-if="spuTableData != null">
                <el-table :data="spuTableData" width="90%" stripe @cell-dblclick="choiceSpu" style="width: 100%">
                    <el-table-column prop="goodsId" label="商品id" width="180"></el-table-column>
                    <el-table-column prop="name" label="商品名" ></el-table-column>
                </el-table>
            </template>
            <template v-else>
                <span class="panel-heading">数据待加载...</span>
            </template>
        </div>
        <div class="col-sm-7" style="border-left:1px solid #000">
            <template v-if="skuTableData != null" height="100%">
                <div class="panel-heading">(*温馨提示:下列表格是选中商品的sku列表,双击即可添加至正在新建的活动商品中)</div>
                <el-table :data="skuTableData" width="90%" stripe  style="width: 100%">
                    <el-table-column prop="productId" label="产品id" width="180"></el-table-column>
                    <el-table-column prop="totalPrice" label="产品价格" width="180"></el-table-column>
                    <el-table-column prop="optionNames" label="产品规格选项" width="180"></el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button size="mini" @click="choiceSku(scope.row)">
                                <span v-if="scope.row.addOrDel == false">添加</span>
                                <span v-else>删除</span>
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </template>
        </div>
    </div>
    <!-- 商品三级分类选择 -->
    <el-dialog title="选择" :visible.sync="goodsCategoryDialogVisible" width="40%">
        <div class="el-form-item">
            <label class="el-form-item__label" style="width: 80px;">商品分类</label>
            <div class="el-form-item__content" style="margin-left: 80px;">
                <el-cascader style="width: 90%" filterable
                             v-model="categoryId"
                             :options="categoryTree"
                             @change="categoryChange">
                </el-cascader>
            </div>
        </div>
        </span>
    </el-dialog>
</div>

<script src="${request.contextPath}/statics/js/modules/goodsConfigChangePrice/goodsconfigchangeprice.js?_${.now?long}"></script>
<style>
    .el-button.is-round {
        border-radius: 20px;
        padding: 2px 3px;
    }
    .el-input__inner{
        height: 30px;
        line-height: 30px;
    }
    .el-table__row.td {
        height:20px;
    }
    .el-button--info.is-plain {
        color: #909399;
        background: #f4f4f5;
        border-color: #d3d4d6;
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .form-control.a.input-sm{
        width:80px;
    }
</style>
</body>
</html>